home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.11 Nov 87 / ZBasic Text Edit / pass source / PASS.BAS next >
Encoding:
BASIC Source File  |  1987-09-22  |  1.1 KB  |  36 lines  |  [TEXT/ZBAS]

  1. WINDOW OFF
  2. COORDINATE WINDOW
  3. ' Find out what application is named
  4. ResName$=FILES$(1,"",,vol%)
  5. IF ResName$="" THEN END
  6. 'Open application resource file
  7. Refnum=FN OPENRESFILE(ResName$)
  8. Errnum=FN RESERROR
  9. LONG IF Errnum<>0
  10. BEEP:PRINT"ERROR# ";Errnum
  11. PRINT "Problem with Resource File!"
  12. FOR i=1 TO 1000:NEXT i:END
  13. END IF
  14. CALL LOADRESOURCE(Refnum):'Load Resource into memory
  15. Rhndl&=FN GETRESOURCE(CVI("PASS"),1)
  16. ResPtr&=USR3(Rhndl&):'Lock the handle and return a pointer
  17. firstint=PEEK WORD(ResPtr&):' get the first integer
  18. secondint=PEEK WORD(ResPtr&+2):'get the second integer
  19. FOR i=1 TO PEEK(ResPtr&+4)
  20. string$=string$+CHR$(PEEK(ResPtr&+4+i))
  21. NEXT i
  22. PRINT firstint,secondint,string$
  23. POKE WORD(ResPtr&),secondint:'save second into 1st integer
  24. POKE WORD(ResPtr&+2),firstint:' save first into 2nd integer
  25. POKE(ResPtr&+4),LEN(string$)
  26. FOR i=LEN(string$) TO 1 STEP -1
  27. Newstring$=Newstring$+MID$(string$,i,1)
  28. NEXT i
  29. FOR i=1 TO LEN(Newstring$)
  30. POKE(ResPtr&+4+i),(ASC(MID$(Newstring$,i,1)))
  31. NEXT i
  32. CALL CHANGEDRESOURCE(Rhndl&)
  33. ResPtr&=USR7(Rhndl&):' Unlock the resource handle
  34. CALL CLOSERESFILE(Refnum)
  35. END
  36.